package com.sqy.controller;

import com.sqy.entity.Dahongpao;
import com.sqy.exception.ImoocMallExceptionEnum;
import com.sqy.service.DahongpaoService;
import com.sqy.utlis.ApiResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Dahongpao")
@Api(tags = "大红袍数据")
public class DahongpaoController {

    @Autowired
    DahongpaoService dahongpaoService;

    @PostMapping("/add")
    public ApiResult addDahongpao(@RequestBody Dahongpao dahongpao){

        boolean save = dahongpaoService.save(dahongpao);

        if(save){
            return  ApiResult.success();
        }
        return  ApiResult.error(ImoocMallExceptionEnum.ADD_FAIL);
    }
}
